package com.git.hui.yinshua.biz.user.dao.mapper;

import com.git.hui.yinshua.biz.user.dao.domain.UserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;

/**
 * @author YiHui
 * @date 2024/6/7
 */
@Mapper
public interface UserMapper {

    Integer saveUser(@Param("user") UserEntity user);

    Integer updateUser(UserEntity user);

    UserEntity queryUserById(@Param("userId") Integer uId);

    UserEntity queryUserByWxId(@Param("wxId") String wxId);

    UserEntity queryUserByUname(@Param("uname") String uname);

    List<UserEntity> listByUsers(@Param("ids") Collection<Integer> uids);

    List<UserEntity> listUser(
            @Param("uname") String uname,
            @Param("nickname") String nickname,
            @Param("phone") String phone,
            @Param("start") Integer start,
            @Param("size") Integer size);

    /**
     * 总数统计
     *
     * @return
     */
    int userCount(@Param("uname") String uname,
                  @Param("nickname") String nickname,
                  @Param("phone") String phone);
}
